package com.financing.platform.dao.impl;

import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.ICountInfoDao;
import com.financing.platform.dto.CountInfoDTO;
import com.financing.platform.util.SqlName;
import com.financing.platform.vo.AuthUserDetailedListVO;
import com.financing.platform.vo.OrderDetailedListVO;
import com.financing.platform.vo.SalesPerformanceVO;

/**
 * @Title: CountInfoDaoImpl.java
 * @Package com.financing.platform.dao.impl
 * @Description: 统计信息DAO实现 
 * @author  qiye
 * @date 2014年10月31日 上午9:42:25
 * @version V1.0
 */
@Repository("countInfoDaoImpl")
public class CountInfoDaoImpl extends BaseDaoImpl implements ICountInfoDao {

	@SuppressWarnings("unchecked")
	public List<CountInfoDTO> queryCountInfoList(Map<String,Object> params) {
		try {
			return this.sqlMapClient.queryForList(SqlName.queryCountInfo,params);
		} catch (SQLException e) {
			log.error("query count info list error !",e);
			return Collections.emptyList();
		}
	}

	public int addCountInfo(CountInfoDTO countInfoDTO) throws SQLException {
		return (Integer) this.sqlMapClient.insert(SqlName.insertCountInfo, countInfoDTO);
	}

	public int updateCountInfo(CountInfoDTO countInfoDTO) throws SQLException {
		return this.sqlMapClient.update(SqlName.updateCountInfo, countInfoDTO);
	}

	public int registPersonCount() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.registPersonCount);
	}

	public int registVerifyPass() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.registVerifyPass);
	}

	public int registVerifyNoPass() throws SQLException {
			return (Integer) this.sqlMapClient.queryForObject(SqlName.registVerifyNoPass);
	}

	public int orderPerSuccessPerson() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderPerSuccessPerson);
	}

	public int orderPerFailPerson() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderPerFailPerson);
	}

	public int orderRebateSuccessPerson() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderRebateSuccessPerson);
	}

	public int orderCancelPerson() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderCancelPerson);
	}

	public int orderPerSuccess() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderPerSuccess);
	}

	public int orderPerFail() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderPerFail);
	}

	public int productOrderRebateSuccess() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.productOrderRebateSuccess);
	}

	public int productOrderCancel() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.productOrderCancel);
	}

	public int orderPerPerson() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderPerPerson);
	}

	public int orderPer() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.orderPer);
	}

	public int forWardNum() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.forWardNum);
	}

	public Integer queryTotalCount(String statement) throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(statement);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<OrderDetailedListVO> queryOrderDetailedList(
			OrderDetailedListVO orderDetailedListVO)throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.OrderDetailedList,orderDetailedListVO);
	}

	@Override
	public int queryOrderDetailedListCount(OrderDetailedListVO orderDetailedListVO)throws SQLException {
		return  (Integer) this.sqlMapClient.queryForObject(SqlName.OrderDetailedListCount,orderDetailedListVO);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<AuthUserDetailedListVO> queryAuthUserDetailedList(
			AuthUserDetailedListVO authUserDetailedListVO) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryAuthUserDetailedList,authUserDetailedListVO);
	}

	@Override
	public int queryAuthUserDetailedListCount(
			AuthUserDetailedListVO authUserDetailedListVO) throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.queryAuthUserDetailedListCount,authUserDetailedListVO);
	}

	@Override
	public List<SalesPerformanceVO> querySalesPerformanceOrder(SalesPerformanceVO salesPerformanceVO)
			throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.querySalesPerformanceOrder,salesPerformanceVO);
	}

	@Override
	public List<SalesPerformanceVO> querySalesPerformanceRegister(SalesPerformanceVO salesPerformanceVO)
			throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.querySalesPerformanceRegister,salesPerformanceVO);
	}

	@Override
	public List<SalesPerformanceVO> querySalesPerformanceVisit(SalesPerformanceVO salesPerformanceVO)
			throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.querySalesPerformanceVisit,salesPerformanceVO);
	}

	@Override
	public List<SalesPerformanceVO> queryAccountFinancialCount(SalesPerformanceVO salesPerformanceVO)
			throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryAccountFinancialCount,salesPerformanceVO);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Map<String, Object>> queryOperateStatistics() throws SQLException {
		return (List<Map<String, Object>>) this.sqlMapClient.queryForList(SqlName.queryOperateStatistics);
	}
	
	@Override
	public List<Map<String, Object>> queryOrderCountByMonth()
			throws SQLException {
		return (List<Map<String, Object>>) this.sqlMapClient.queryForList(SqlName.queryOrderCountByMonth);

	}

	@Override
	public Map<String, Object> queryOrderUserPer() throws SQLException {
		return (Map<String, Object>) this.sqlMapClient.queryForObject(SqlName.queryOrderUserPer);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Map<String, Object>> queryFaUserRegisterByMonthCount(Map<String,Object> params) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryFaUserRegisterByMonthCount, params);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Map<String, Object>> queryFaUserRoleCount(Map<String,Object> params) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryFaUserRoleCount, params);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Map<String, Object>> queryFaUserCount(Map<String,Object> params) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryFaAllUserCount, params);
	}

	@Override
	public List<Map<String, Object>> queryFaUserRoleProportion(Map<String, Object> params) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryFaUserRoleProportion, params);
	}

	@Override
	public List<Map<String, Object>> queryOrderFaUserRoleProportion(Map<String, Object> params) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryOrderFaUserRoleProportion, params);
	}

	@Override
	public List<Map<String, Object>> queryUserTotalSales(CountInfoDTO countInfo) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.queryUserTotalSales,countInfo);
	}

	
}

	